package com.ruoyi.web.controller.test;

import java.util.Map;

// 饿汉模式，线程安全，性能较好，但可能会浪费资源
public class HungrySingletone {
    private static HungrySingletone hungrySingletone=new HungrySingletone();
    private HungrySingletone(){
    }
    private static HungrySingletone getInstance(){
        return hungrySingletone;
    }

    public static void main(String[] args) {
        final HungrySingletone instance1 = HungrySingletone.getInstance();
        final HungrySingletone instance2 = HungrySingletone.getInstance();
        System.out.println(instance1);
        System.out.println(instance2);
    }
}
